<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<title><{:C("WEB_TITLE")}></title>
<link rel="shortcut icon" href="favicon.ico">
<link href="/Public/Front/css/bootstrap.min.css" rel="stylesheet">
<link href="/Public/Front/css/font-awesome.min.css" rel="stylesheet">
<link href="/Public/Front/css/animate.css" rel="stylesheet">
<link href="/Public/Front/css/style.css" rel="stylesheet">
<link rel="stylesheet" href="/Public/Front/js/plugins/layui/css/layui.css">
<style>
.layui-form-label {width:110px;padding:4px}
</style>
<body>
    <div class="wrapper wrapper-content animated">
        <div class="row">
            <div class="col-sm-12">
            <form class="layui-form" action="" id="payaccess">
            <input type="hidden" name="id" value="<{$pa.id}>">
            <input type="hidden" name="pa[pid]" value="<{$pid}>">
              <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                  <input type="text" name="pa[title]" lay-verify="required" autocomplete="off" value="<{$pa.title}>" placeholder="名称" class="layui-input">
                </div>
              </div>
              
              <div class="layui-form-item">
                  <label class="layui-form-label">商户号(MCHID)：</label>
                  <div class="layui-input-block">
                    <input type="text" name="pa[mch_id]" value="<{$pa.mch_id}>" autocomplete="off" class="layui-input">
                  </div>
             </div>
             <div class="layui-form-item">
                  <label class="layui-form-label">证书密钥：</label>
                    <div class="layui-input-block">
                        <input type="text" placeholder="MD5KEY 或 RSA 密钥" name="pa[signkey]" value="<{$pa.signkey}>" autocomplete="off" class="layui-input">
                    </div>
                </div>
              
              <div class="layui-form-item">
                  <label class="layui-form-label">APPID：</label>
                  <div class="layui-input-inline">
                    <input type="text" name="pa[appid]" autocomplete="off" value="<{$pa.appid}>" placeholder="公众号APPID或商家账号" class="layui-input">
                  </div>
             </div>
             
             <div class="layui-form-item">
                  <label class="layui-form-label">APPSECRET：</label>
                  <div class="layui-input-inline">
                    <input type="text" name="pa[appsecret]" autocomplete="off" value="<{$pa.appsecret}>" placeholder="公众号APPSECRET或安全码" class="layui-input">
                  </div>
             </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">支付宝公钥：</label>
                <div class="layui-input-block">
                    <textarea  name="pa[alipay_public_key]" placeholder="支付宝应用公钥" class="layui-textarea"><?php echo $pa['alipay_public_key']; ?></textarea>
                </div>
            </div>
    
    
            <div class="layui-form-item">
                <label class="layui-form-label">支付宝商户私钥：</label>
                <div class="layui-input-block">
                    <textarea name="pa[merchant_private_key]" placeholder="支付宝生成的商户私钥" class="layui-textarea"><?php echo $pa['merchant_private_key']; ?></textarea>
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">绑定指定商户号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="pa[uid]" autocomplete="off" value="<{$pa.uid}>" placeholder="商户号减去10000 例10002  填2" class="layui-input" style="width: 280px">
                </div>
            </div>
                
             <div class="layui-form-item">
                  <label class="layui-form-label">轮询权重：</label>
                  <div class="layui-input-inline">
                    <input type="text" name="pa[weight]" autocomplete="off" value="<{$pa.weight}>" placeholder="0-9的整数，默认为1" class="layui-input">
                  </div>
             </div>

              <div class="layui-form-item">
                <label class="layui-form-label">费率模式：</label>
                <div class="layui-input-block">
                  <input type="radio" name="pa[custom_rate]" lay-filter="custom_rate" <if condition="$pa[custom_rate] eq 0">checked</if> value="0" title="继承通道" >
                  <input type="radio" name="pa[custom_rate]" lay-filter="custom_rate" <if condition="$pa[custom_rate] eq 1">checked</if> value="1" title="自定义">
                </div>
              </div>
             
             <div id="rate_group" <if condition="$pa[custom_rate] eq 0">style="display: none;"</if>>
               <div class="layui-form-item">
                    <label class="layui-form-label">运营费率：</label>
                    <div class="layui-input-inline">
                      <input type="text" name="pa[defaultrate]" placeholder="运营费率" autocomplete="off" value="<{$pa.defaultrate}>" class="layui-input">
                    </div>
               </div>
               <div class="layui-form-item">
                    <label class="layui-form-label">封顶手续费：</label>
                    <div class="layui-input-inline">
                      <input type="text" name="pa[fengding]" placeholder="封顶手续费" autocomplete="off" value="<{$pa.fengding}>" class="layui-input">
                    </div>
               </div>
               <div class="layui-form-item">
                    <label class="layui-form-label">成本费率：</label>
                    <div class="layui-input-inline">
                      <input type="text" name="pa[rate]" placeholder="成本费率" autocomplete="off" value="<{$pa.rate}>" class="layui-input">
                    </div>
               </div>
             </div>

              <div class="layui-form-item">
                <label class="layui-form-label">状态：</label>
                <div class="layui-input-block">
                  <input type="radio" name="pa[status]" <if condition="$pa[status] eq 1">checked</if> value="1" title="开启" checked="">
                  <input type="radio" name="pa[status]" <if condition="$pa[status] eq 0">checked</if> value="0" title="关闭">
                </div>
              </div>
              
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit="submit" lay-filter="add">提交保存</button>
                </div>
              </div>
            </form>
            </div>
        </div>
    </div>

    <script src="/Public/Front/js/jquery.min.js"></script>
    <script src="/Public/Front/js/bootstrap.min.js"></script>
    <script src="/Public/Front/js/plugins/peity/jquery.peity.min.js"></script>
    <script src="/Public/Front/js/content.js"></script>
    <script src="/Public/Front/js/plugins/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use(['layer', 'form'], function(){
  var form = layui.form
  ,layer = layui.layer;
  
  //监听提交
  form.on('submit(add)', function(data){
    $.ajax({
        url:"<{:U('Channel/saveEditAccount')}>",
        type:"post",
        data:$('#payaccess').serialize(),
        success:function(res){
            if(res.status){
                layer.alert("编辑成功", {icon: 6},function () {
                    parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                });
            }else{
                layer.msg("操作失败!", {icon: 5},function () {
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                });
                return false;
            }
        }
    });
    return false;
  });

  form.on('radio(custom_rate)', function(data) {
    if (data.value == 1) {
      $('#rate_group').show();
    } else {
      $('#rate_group').hide();
    }
  })
});
</script>
<!--统计代码，可删除-->
</body>
</html>
